#pragma once

namespace AVUI {

    class FrameworkObject
    {
    public:
#pragma region Internal Methods

        FrameworkObject(DependencyObject* pDO);
        FrameworkObject(DependencyObject* pDO, bool throwIfNeither);
        FrameworkObject(FrameworkElement* pFE, FrameworkContentElement* pFCE);

        void BeginInit();
        void ChangeLogicalParent(DependencyObject* pNewParent);
        void ChangeSubtreeHasLoadedChangedHandler(DependencyObject* pMentor);
        void EndInit();
        Object* FindName(String* pName, DependencyObject** ppScopeOwner);
        static FrameworkObject GetContainingFrameworkElement(DependencyObject* pCurrent);
        FrameworkObject GetPreferVisualParent(bool force);
        static bool IsEffectiveAncestor(DependencyObject* pD1, DependencyObject* pD2);
        void OnInheritedPropertyChanged(InheritablePropertyChangeInfo* pInfo);
        void OnLoaded(RoutedEventArgs* pArgs);
        void OnUnloaded(RoutedEventArgs* pArgs);
        void RaiseEvent(RoutedEventArgs* pArgs);
        void Reset(DependencyObject* pDO);
        void SetShouldLookupImplicitStyles();
#pragma endregion Internal Methods

#pragma region Internal Properties

        DependencyObject* get_DO();
        DependencyObject* get_EffectiveParent();
        FrameworkContentElement* get_FCE();
        FrameworkElement* get_FE();
        FrameworkObject get_FrameworkParent();
        void set_HasResourceReference(bool value);
        void set_HasTemplateChanged(bool value);
        InheritanceBehavior::Enum get_InheritanceBehavior();
        bool get_IsFCE();
        bool get_IsFE();
        bool get_IsInitialized();
        bool get_IsLoaded();
        bool get_IsStyleSetFromGenerator();
        void set_IsStyleSetFromGenerator(bool value);
        bool get_IsValid();
        XmlLanguage* get_Language();
        DependencyObject* get_Parent();
        FrameworkObject get_PreferVisualParent();
        bool get_ShouldLookupImplicitStyles();
        void set_ShouldLookupImplicitStyles(bool value);
        bool get_StoresParentTemplateValues();
        void set_StoresParentTemplateValues(bool value);
        Style* get_Style();
        void set_Style(Style* pValue);
        bool get_SubtreeHasLoadedChangeHandler();
        void set_SubtreeHasLoadedChangeHandler(bool value);
        int get_TemplateChildIndex();
        DependencyObject* get_TemplatedParent();
        FrameworkTemplate* get_TemplateInternal();
        Style* get_ThemeStyle();
        bool get_ThisHasLoadedChangeEventHandler();

#pragma endregion Internal Properties

        void add_InheritedPropertyChanged(InheritedPropertyChangedEventHandler* pValue);
        void remove_InheritedPropertyChanged(InheritedPropertyChangedEventHandler* pValue);

#pragma region Internal Events

        void add_Loaded(RoutedEventHandler* pValue);
        void remove_Loaded(RoutedEventHandler* pValue);

        void add_ResourcesChanged(EventHandler* pValue);
        void remove_ResourcesChanged(EventHandler* pValue);

        void add_Unloaded(RoutedEventHandler* pValue);
        void remove_Unloaded(RoutedEventHandler* pValue);

#pragma endregion Internal Events

    private:

#pragma region Private Methods

        FrameworkObject GetRawPreferVisualParent();
        void UnexpectedCall();

#pragma endregion Private Methods

#pragma region Private Fields

        TRefCountedPtr<DependencyObject> m_pDO;
        FrameworkContentElement* m_pFCE;
        FrameworkElement* m_pFE;

#pragma endregion Private Fields

    };

};


